package com.yc.baseapi;

public class TestRegular {
	
	/**
	 * 正则表达式中^和$有特殊的含义，代表
	 * 匹配文本的开头，匹配文本的结尾
	 */
	public void m1() {
		String a = "aaabbbcc";
		System.out.println(a.replaceFirst("aaa", "ccc"));
		String b = "^aaa^bbbcc";
		System.out.println(b.replaceFirst("\\^aaa\\^", "ccc"));
	}

	public static void main(String[] args) {
		TestRegular tr = new TestRegular();
		tr.m1();

	}

}
